import { S } from '../s';
import { IPSAppMethodDTO } from './ipsapp-method-dto';
import { IPSAppMethodDTOField } from './ipsapp-method-dtofield';
import { PSModelObjectImpl } from '../psmodel-object-impl';

export class PSAppMethodDTOImpl
  extends PSModelObjectImpl
  implements IPSAppMethodDTO
{
  get codeName(): string {
    return this.M.codeName;
  }

  protected psappmethoddtofields: IPSAppMethodDTOField[];
  getPSAppMethodDTOFields(): IPSAppMethodDTOField[] | null {
    return (
      this.psappmethoddtofields ||
      (this.psappmethoddtofields = this.fillChildListModel(
        this.M.getPSAppMethodDTOFields,
        S._3e7,
      ) as IPSAppMethodDTOField[])
    );
  }

  findPSAppMethodDTOField(objKey: any): IPSAppMethodDTOField | null {
    return this.getPSModel5(
      S._3e7,
      this.getPSAppMethodDTOFields(),
      objKey,
    ) as IPSAppMethodDTOField;
  }

  get sourceType():
    | 'DE'
    | 'DYNAMODEL'
    | 'DEACTIONINPUT'
    | 'DEFILTER'
    | 'REFDE'
    | 'DEDATASETINPUT' {
    return this.M.sourceType;
  }

  get type(): 'DEFAULT' | 'DEACTIONINPUT' | 'DEFILTER' | 'DEDATASETINPUT' {
    return this.M.type;
  }
  get cls(): string {
    return 'PSAppMethodDTOImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._3ed) return true;
    return super.instanceof(cls);
  }
}
